package ua.org.enginer.controls
{
	import mx.containers.Form;
	import mx.controls.ComboBase;
	import mx.controls.ComboBox;
	import mx.core.Container;
	
	public class EditableForm extends Form
	{
		public function EditableForm()
		{
			super();
		}
		
		private var _editable:Boolean = true
		public function set editable(value:Boolean) : void {
			_editable = value
			setEditable(getChildren())
		}
		[Bindable]
		public function get editable() : Boolean {
			return _editable
		}
		
		private function setEditable(childs:Array):void {
			for each(var o:Object in childs){
				if (o is ComboBase) continue;
				if (o.hasOwnProperty("editable"))
					o["editable"] = editable
					
				if (o is Container)
					setEditable(Container(o).getChildren())
			}
		}
	}
}